package com.zzh.sqllib.greendao.gen;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.zzh.sqllib.bean.ActionBean;
import com.zzh.sqllib.bean.ContextBean;
import com.zzh.sqllib.bean.ProjectBean;

import com.zzh.sqllib.greendao.gen.ActionBeanDao;
import com.zzh.sqllib.greendao.gen.ContextBeanDao;
import com.zzh.sqllib.greendao.gen.ProjectBeanDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig actionBeanDaoConfig;
    private final DaoConfig contextBeanDaoConfig;
    private final DaoConfig projectBeanDaoConfig;

    private final ActionBeanDao actionBeanDao;
    private final ContextBeanDao contextBeanDao;
    private final ProjectBeanDao projectBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        actionBeanDaoConfig = daoConfigMap.get(ActionBeanDao.class).clone();
        actionBeanDaoConfig.initIdentityScope(type);

        contextBeanDaoConfig = daoConfigMap.get(ContextBeanDao.class).clone();
        contextBeanDaoConfig.initIdentityScope(type);

        projectBeanDaoConfig = daoConfigMap.get(ProjectBeanDao.class).clone();
        projectBeanDaoConfig.initIdentityScope(type);

        actionBeanDao = new ActionBeanDao(actionBeanDaoConfig, this);
        contextBeanDao = new ContextBeanDao(contextBeanDaoConfig, this);
        projectBeanDao = new ProjectBeanDao(projectBeanDaoConfig, this);

        registerDao(ActionBean.class, actionBeanDao);
        registerDao(ContextBean.class, contextBeanDao);
        registerDao(ProjectBean.class, projectBeanDao);
    }
    
    public void clear() {
        actionBeanDaoConfig.clearIdentityScope();
        contextBeanDaoConfig.clearIdentityScope();
        projectBeanDaoConfig.clearIdentityScope();
    }

    public ActionBeanDao getActionBeanDao() {
        return actionBeanDao;
    }

    public ContextBeanDao getContextBeanDao() {
        return contextBeanDao;
    }

    public ProjectBeanDao getProjectBeanDao() {
        return projectBeanDao;
    }

}
